package org.ttitfly.workflow.engine.run;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 流程实例数据
 * 
 * @author 潘海春
 * @version 2009-9-18
 */
@Entity
@Table(name = "WF_PROCESS_INSTANCE")
public class ProcessInstance extends WFEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/** 流程名称 */
	@Column(name = "PROCESS_NAME")
	private String processName;

	/** 版本 */
	@Column(name = "VERSION")
	private float processVersion;

	/** 父任务 */
	@JoinColumn(name = "PARENT")
	@ManyToOne
	private Task parent;

	/** 名称 */
	@Column(name = "NAME")
	private String name;

	/** 状态 */
	@Column(name = "STATUS")
	private int status;

	/** 激活时间 */
	@Column(name = "ACTIVATION_TIME")
	private Date activationTime;

	/** 关闭时间 */
	@Column(name = "CLOSE_TIME")
	private Date closeTime;

	/** 创建人 */
	@Column(name = "CREATOR")
	private String creator;

	/** 任务 */
	@OneToMany(mappedBy = "processInstance")
	private List<Task> tasks = new ArrayList<Task>();

	public String getProcessName() {
		return processName;
	}

	public void setProcessName(String processName) {
		this.processName = processName;
	}

	public float getProcessVersion() {
		return processVersion;
	}

	public void setProcessVersion(float processVersion) {
		this.processVersion = processVersion;
	}

	public Task getParent() {
		return parent;
	}

	public void setParent(Task parent) {
		this.parent = parent;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Date getActivationTime() {
		return activationTime;
	}

	public void setActivationTime(Date activationTime) {
		this.activationTime = activationTime;
	}

	public Date getCloseTime() {
		return closeTime;
	}

	public void setCloseTime(Date closeTime) {
		this.closeTime = closeTime;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public List<Task> getTasks() {
		return tasks;
	}

	public void setTasks(List<Task> tasks) {
		this.tasks = tasks;
	}

}
